<?php

namespace App\Http\Middleware;

use Closure;
use Auth;
use App\Models\Adminer;

class Permission
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     * 用于菜单权限只有超级管理员的权限
     */
    public function handle($request, Closure $next)
    {
        $id = Auth::guard('admin')->id();
        $user = Adminer::findorfail($id);

/*        if(!$user->hasRole('管理员') || !$user->hasRole('超级管理员')){
            return redirect()->route('error');
        }*/
        return $next($request);
    }
}
